package com.github.wxiaoqi.security.biz.modules.community.api;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.wxiaoqi.security.biz.common.cms.request.CmsTopicCustomerQueryParam;
import com.github.wxiaoqi.security.biz.common.cms.request.CmsTopicCustomerRequestParam;
import com.github.wxiaoqi.security.biz.modules.community.biz.CmsTopicCustomerBiz;
import com.github.wxiaoqi.security.biz.modules.community.entity.CmsTopicCustomer;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.EntityUtils;

import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;


@Slf4j
@Controller
@RequestMapping("cmsTopicCustomers")
public class CmsTopicCustomerController extends BaseController<CmsTopicCustomerBiz,CmsTopicCustomer> {
	
	@ApiOperation("关注话题")
	@ResponseBody
	@RequestMapping(value="/follow", method = RequestMethod.POST)
	public Map<String, Object> followTopic(@RequestBody CmsTopicCustomerRequestParam param) throws Exception {
		log.info("关注话题 请求参数：{}",EntityUtils.beanToMap(param));
		return baseBiz.addTopicCustomer(param);
	}
	
	@ApiOperation("取消关注话题")
	@ResponseBody
	@RequestMapping(value="/cancelFollow", method = RequestMethod.POST)
	public Map<String, Object> cancelFollowTopic(@RequestBody CmsTopicCustomerRequestParam param) throws Exception {
		log.info("取消关注话题 请求参数：{}",EntityUtils.beanToMap(param));
		return baseBiz.updateTopicCustomer(param);
	}
	
	
	@ApiOperation("关注话题列表")
	@ResponseBody
	@RequestMapping(value="/list", method = RequestMethod.POST)
	public Map<String, Object> followTopics(@RequestBody CmsTopicCustomerQueryParam param) throws Exception {
		log.info("关注话题列表 请求参数：{}",EntityUtils.beanToMap(param));
		return baseBiz.followTopics(param);
	}
	
}